﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using DeviceInfoManage.BusinessLogicLayer;
public partial class DeviceRepairDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminUserName"] == null)
        {
            Response.Redirect("login.aspx");
        }
        /*取得维修记录编号*/
        string repairId = Request.QueryString["repairId"];
        RepairInfo repairInfo = new RepairInfo();
        /*根据维修记录编号得到该维修记录各个字段信息*/
        repairInfo.GetRepairInfo(Int32.Parse(repairId));
        this.DeviceName.Text = (new DeviceInfo()).GetDeviceName(Convert.ToInt32(repairInfo.DeviceId));
        this.DeviceTypeName.Text = (new DeviceType()).GetDeviceType(Convert.ToInt32(repairInfo.DeviceId));
        this.RepairPlace.Text = repairInfo.RepairPlace;
        this.RepairMan.Text = repairInfo.RepairMan;
        this.ErrReason.Text = repairInfo.ErrReason;
        this.RepairStartTime.Text = repairInfo.RepairStartTime.ToShortDateString();
        this.RepairEndTime.Text = repairInfo.RepairEndTime.ToShortDateString();
        this.RepairTime.Text = repairInfo.RepairTime.ToString();
        this.RepairMoney.Text = repairInfo.RepairMoney.ToString();
        this.RepairMemo.Text = repairInfo.RepairMemo;
        /*取得该设备的图片路径，如果存在图片就显示*/
        string deviceImagePath = (new DeviceInfo()).GetDeviceImagePath(repairInfo.DeviceId);
        if (deviceImagePath != "")
            this.DeviceImage.ImageUrl = deviceImagePath;
        else
            this.DeviceImage.ImageUrl = "images\\NoImage.jpg";
            
    }
}
